<%@ page language="java" pageEncoding="UTF-8"%>
<div class="container">

	<ul class="nav nav-tabs">
		<li ng-repeat="type in types" ng-class="{'active':type.select}">
			<a ng-href="#/user/mail?type={{type.id}}">{{type.name}}</a>
		</li>
		<li class="pull-right">
			<button type="button" class="btn btn-default"  ng-click="create()"><i class="glyphicon glyphicon-send"></i> 发送</button>
		</li>
	</ul>
	
	<br/>
	
	<div ng-show="mail==null || mail.data==null || mail.data.length==0">
		<div class="alert alert-info"><i class="glyphicon glyphicon-exclamation-sign"></i> 暂时没有邮件</div>
	</div>
	
	<div ng-repeat="mail in mail.data" class="media msg">
		<div ng-show="!mail.remove">
			<div class="clearfix">
				<div class="pull-left">
					<a class="pull-left" ng-href="#/user/{{mail.author.id}}/home">
						<img class="media-object panel panel-default" style="width: 50px; height: 50px;" ng-src="{{mail.author.headphoto | path}}">
					</a>
				</div>
				<div class="pull-left" style="margin-left: 10px;"">
					<a href="javascript:void(0);" ng-click="pre(mail)" title="{{mail.title | textOnly}}">
						{{mail.title | summary:80}}
					</a>
					
					<div style="color: #777;margin-top:20px; margin-left: 10px;">
						{{mail.content | textOnly | summary:80}}
					</div>
					
					<div style="color: #777;margin-top:20px; margin-left: 10px;">
						<span style="margin-right: 10px;">
							<i class="glyphicon glyphicon-user"></i> <a ng-href="#/user/{{mail.author.id}}/home">{{mail.author.username}}</a>
						</span>
						<span style="margin-right: 10px;" message="'发送于{{mail.create_time | formatDate}}'" tooltip>
							<i class="glyphicon glyphicon-time"></i> {{mail.create_time | formatDate:true}}
						</span>
						<span style="margin-right: 10px;">
							<button type="button" class="btn btn-success btn-xs"  ng-click="setRead(mail)" ng-show="!mail.read"><i class="glyphicon glyphicon-ok-sign"></i> 已读</button>
							<button type="button" class="btn btn-danger btn-xs"  ng-click="remove(mail)"><i class="glyphicon glyphicon-remove-sign"></i> 删除</button>
						<span>
					</div>
				</div>
			</div>
			<hr/>
		</div>
	</div>
	<paginate page-count="mail.page_count" sum="mail.data_sum" pn="mail.pn" click="find"></paginate>
</div>